<?
include_once "JCAT_Archive.class.php" ;

class DlgClassBase extends JCAT_GtkDialog
{
	function DlgClassBase()
	{
		$this->JCAT_GtkDialog() ;
	}
	
	protected function InitWidget()
	{
		// 初始化窗口
		$this->AddWidgetName('EntName','GtkEntry') ;
		$this->AddWidgetName('SelType','GtkComboBox') ;
		$this->AddWidgetName('SelParentPackege','GtkComboBox') ;
		$this->AddWidgetName('SelEntID','GtkComboBoxEntry') ;
		$this->AddWidgetName('EntID','GtkEntry') ;
		$this->AddWidgetName('BtnOk','GtkButton') ;
		$this->AddWidgetName('BntCannel','GtkButton') ;
		
		$this->CreateByGlade('./glades/DlgClass.template.glade','DlgClass') ;

		ASSERT( $this->wndEntName = $this->GetChildWidget('EntName') ) ;
		ASSERT( $this->wndSelType = $this->GetChildWidget('SelType') ) ;
		ASSERT( $this->wndSelParentPackege = $this->GetChildWidget('SelParentPackege') ) ;
		ASSERT( $this->wndSelEntID = $this->GetChildWidget('SelEntID') ) ;
		ASSERT( $this->wndEntID = $this->GetChildWidget('EntID') ) ;
		ASSERT( $this->wndBtnOk = $this->GetChildWidget('BtnOk') ) ;
		ASSERT( $this->wndBntCannel = $this->GetChildWidget('BntCannel') ) ;
		
		// 连接按钮事件
		$this->wndBtnOk->connect_simple('clicked',array($this,'OnBtnOk')) ;
		$this->wndBntCannel->connect_simple('clicked',array($this,'OnBntCannel')) ;

		// ... ...
		
		// 视图

		// ... ...

	}
	
	// 声明子窗体
	protected $wndEntName ;
	protected $wndSelType ;
	protected $wndSelParentPackege ;
	protected $wndSelEntID ;
	protected $wndEntID ;
	protected $wndBtnOk ;
	protected $wndBntCannel ;


	// 声明内部数据
	protected $sEntName = '' ;
	protected $nSelType = -1 ;
	protected $nSelParentPackege = -1 ;
	protected $sEntID = '' ;


	// 数据交换
	public function UpdateData($bUICtr2Var=true)
	{
		if($bUICtr2Var)
		{
			$this->sEntName = $this->wndEntName->get_text() ;
			$this->nSelType = $this->wndSelType->get_active() ;
			$this->nSelParentPackege = $this->wndSelParentPackege->get_active() ;
			$this->sEntID = $this->wndEntID->get_text() ;
			// ... ...
		}
		else
		{
			$this->wndEntName->set_text($this->sEntName) ;
			$this->wndSelType->set_active($this->nSelType) ;
			$this->wndSelParentPackege->set_active($this->nSelParentPackege) ;
			$this->wndEntID->set_text($this->sEntID) ;
			// ... ...
		}
	}
	
	// 序列化
	public function Serialize(JCAT_Archive $aArchive)
	{
		if($aArchive->IsLoad())
			JCAT_GtkDialog::Serialize($aArchive) ;
		$aArchive->Value('sEntName',$this->sEntName) ;
		$aArchive->Value('nSelType',$this->nSelType) ;
		$aArchive->Value('nSelParentPackege',$this->nSelParentPackege) ;
		$aArchive->Value('sEntID',$this->sEntID) ;

		// ... ...
		
		if($aArchive->IsSave())
			JCAT_GtkDialog::Serialize($aArchive) ;
	}
	
	// 定义按钮事件
	public function OnBtnOk()
	{
	}

	public function OnBntCannel()
	{
	}



}
?>